extends Item
class_name PassivelItem

@export var upgrades : Array[Stats]
# 升级应用到玩家身上
var player_reference

func is_upgradable()->bool:
	if level <= upgrades.size():
		return true
	else:
		return false

#升级用户
func upgrade_item()->void:
	if not MissingNode:
		return
	if player_reference == null:
		return
	var upgrade = upgrades[level -1]
	
	player_reference.max_health += upgrade.max_health
	player_reference.recovery += upgrade.recovery
	player_reference.armor += upgrade.armor
	player_reference.movement_speed += upgrade.movement_speed
	player_reference.might += upgrade.might
	player_reference.area += upgrade.area
	player_reference.magent += upgrade.magent
	player_reference.growth += upgrade.growth

	level += 1	
